//
//  AppreciationDetailView.m
//  Lovelife
//
//  Created by dllo on 15/4/21.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "AppreciationDetailView.h"
#import "NightManager.h"
@implementation AppreciationDetailView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.photoArr = [NSMutableArray array];

    }
#pragma title
    self.titleLabel = [[BaseLabel alloc]init];
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
#pragma 不明所以的第三方
    self.photoView = [[SDCycleScrollView alloc]init];
    self.photoView.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
    self.photoView.delegate = self;
    self.photoView.dotColor = [UIColor redColor];
        
#pragma 详情label
    self.detailLabel = [[BaseLabel alloc]init];
    _detailLabel.numberOfLines = 0;
    
#pragma 最大的..
    self.digScroller = [[UIScrollView alloc]init ];

    [_digScroller addSubview:_detailLabel];
    [_detailLabel release];
    [_digScroller addSubview:self.photoView];
    [_photoView release];
    [_digScroller addSubview:_titleLabel];
    [_titleLabel release];
    [self addSubview:_digScroller];
    [_digScroller release];
    
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(0, 10, self.frame.size.width, 20);
    self.detailLabel.frame = CGRectMake(0, 280, self.frame.size.width, self.height);
    [self.detailLabel sizeToFit];
    self.digScroller.contentSize = CGSizeMake(self.frame.size.width, 500 + self.detailLabel.frame.size.height);
    self.photoView.frame = CGRectMake(0, 40, self.frame.size.width, 240);
    self.photoView.dotColor = [UIColor whiteColor]; // 自定义分页控件小圆标颜色
    self.photoView.autoScrollTimeInterval = 4.0;
    self.digScroller.frame = self.frame;
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.photoView.imageURLsGroup = self.photoArr;
    });
}

- (void)dealloc
{
    [_titleLabel release];
    [_detailLabel release];
    [_digScroller release];
    [_photoView release];
    [_photoArr release];
    [_model release];
    [super dealloc];
}

- (void)setNightDayModel
{
    [NightManager setLabelColorWithLabel:self.titleLabel];
    [NightManager setLabelColorWithLabel:self.detailLabel];
    [NightManager setBackgroundColorWithView:self.digScroller];
    [NightManager setBackgroundColorWithView:self.photoView];
    [NightManager setBackgroundColorWithView:self];
}

- (void)setLightDayModel
{
    [NightManager setLabelColorWithLabel:self.titleLabel];
    [NightManager setLabelColorWithLabel:self.detailLabel];
    [NightManager setBackgroundColorWithView:self.digScroller];
    [NightManager setBackgroundColorWithView:self.photoView];
    [NightManager setBackgroundColorWithView:self];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
